package com.logistics.inventory.entity.model;

import com.logistics.inventory.entity.domain.InventoryDetail;
import com.logistics.log.entity.domain.Log;
import com.logistics.log.entity.model.LogRow;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class InventoryDetailRow {

    private Integer id;
    // 托盘号
    private String container;

    // 物料编码
    private String itemCode;

    // 任务号
    private String itemWorkcode;

    // 工序号
    private String itemOpNo;

    // 物料名称
    private String itemName;

    // 物料单位
    private String itemUnit;

    // 数量
    private BigDecimal itemQty;

    private Integer itemSeqNo;
    private String createOrgCode;
    private String createDepCode;
    private String creator;
    private String createTime;
    private String updater;
    private String updateTime;

    public InventoryDetailRow(InventoryDetail inventoryDetail){
        this.id = inventoryDetail.getId();
        this.container = inventoryDetail.getContainer();
        this.itemCode = inventoryDetail.getItemCode();
        this.itemWorkcode = inventoryDetail.getItemWorkcode();
        this.itemOpNo = inventoryDetail.getItemOpNo();
        this.itemName = inventoryDetail.getItemName();
        this.itemUnit = inventoryDetail.getItemUnit();
        this.itemQty = inventoryDetail.getItemQty();
        this.itemSeqNo = inventoryDetail.getItemSeqNo();
        this.createOrgCode = inventoryDetail.getCreateOrgCode();
        this.createDepCode = inventoryDetail.getCreateDepCode();
        this.creator = inventoryDetail.getCreator();
        this.createTime = DateUtils.dateToStringFormat(inventoryDetail.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.updater = inventoryDetail.getUpdater();
        this.updateTime = DateUtils.dateToStringFormat(inventoryDetail.getUpdateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
    }

    public static InventoryDetailRow build(InventoryDetail inventoryDetail){
        return new InventoryDetailRow(inventoryDetail);
    }
}
